<?php

declare(strict_types=1);

namespace App\Fastapp\Model;

use App\System\Model\SystemUser;
use Hyperf\Database\Model\Relations\HasOne;
use Mine\MineModel;

/**
 * @property int $id 主键
 * @property int $created_by
 * @property int $updated_by
 * @property int $user_id 用户id
 * @property int $admin_id 管理员id
 * @property string $bus_type 业务类型agent_bus_type
 * @property string $remark 备注
 * @property-read null|SystemUser $admin
 */
class FastappChannelAgent extends MineModel
{
    public bool $timestamps = false;
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'fastapp_channel_agent';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'created_by', 'updated_by', 'user_id', 'admin_id', 'bus_type', 'remark'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'created_by' => 'integer', 'updated_by' => 'integer', 'user_id' => 'integer', 'admin_id' => 'integer'];

    public function admin(): HasOne
    {
        return $this->hasOne(SystemUser::class, 'id', 'admin_id');
    }
}
